home *** CD-ROM | disk | FTP | other *** search
/ Inventor Labs: Technology / INVENTORLABS_TECHNOLOGY.BIN / pc / files / shared.cst / 00422_Script_Journal Object < prev    next >
Text File  |  1997-07-24  |  12KB  |  330 lines

  1. --Journal Object
  2. --Instantiated as gJournalObj
  3.  
  4. global gInventorIndexNum, gInterfaceMgrObj
  5. global gBulbExpMgr, gWattBIYobj, gTel  --These may not be right for Edison 
  6.  
  7.  
  8. property pCurrentBIYobj, pBIYobjList, pAtBIY
  9. property pClickBoardSpriteNum, pClickBoardRect, pPICTsprite
  10. property pBaseJournalCastNum, pCheckBaseCastNum, pCheckSpriteNum
  11. property pPICTlist
  12. property pJournalActive
  13.  
  14. --WATT SPECIFIC PROPERTIES
  15. property pCondensorAxisLocHList, pCylinderAxisLocVList, pWattTopBox, pWattBottomBox
  16. --BELL SPECIFIC PROPERTIES
  17. property pBellLocVList, pBellLocHList, pBellTopBox, pBellMiddleBox, pBellBottomBox
  18. --EDISON SPECIFIC PROPERTIES
  19. property pEdisonLocHList, pEdisonLocVList, pEdisonBox
  20.  
  21. global gActiveBYSobj
  22. --------------------------------------------------------------------<<ò>>
  23. on mInit me
  24.   
  25.   set pBIYobjList = [gBulbExpMgr, gTel,gWattBIYobj]
  26.   set pBaseJournalCastNum = the number of cast "EXPDRY1.PIC"
  27.   set pCurrentBIYobj = 0
  28.   set pAtBIY = false
  29.   
  30.   -- sprite declarations
  31.   set pPICTsprite = 2
  32.   set pClickBoardSpriteNum = 19 -- a rect with mJournalClickEvent(gJournalObj) msDn script must be in sprite 20
  33.   --                                                    of each BIY.  It must be completely offStage
  34.   set pCheckSpriteNum = 20 --the check graphic (or placeHolder) must also be off stage in this channel
  35.   
  36.   set pClickBoardRect = rect(60, 80, 420, 440)
  37.   set pCheckBaseCastNum = the number of cast "EXPDRY6.PIC"
  38.   set pPICTlist = ["EXPDRY1.PIC", "EXPDRY2.PIC", "EXPDRY3.PIC"]
  39.   
  40.   --WATT SPECIFIC PROPERTIES
  41.   set pCondensorAxisLocHList = [302, 344, 386]
  42.   set pCylinderAxisLocVList = [213, 235, 258, 309, 332, 354]
  43.   set pWattTopBox = rect(277, 202, 406, 271)
  44.   set pWattBottomBox = rect(277, 298, 406, 367)
  45.   
  46.   --BELL SPECIFIC PROPERTIES
  47.   set pBellLocVList = [177,192,206,222,264,279,293,308,355,370,384,400]
  48.   set pBellLocHList = [302,328,354]
  49.   set pBellTopBox = rect(288, 167, 368, 230)
  50.   set pBellMiddleBox = rect(288, 254, 368, 316)
  51.   set pBellBottomBox = rect(288, 346, 368, 408)
  52.   
  53.   --EDISON SPECIFIC PROPERTIES
  54.   set pEdisonLocHList = [297, 321, 345, 370, 395]
  55.   set pEdisonLocVList = [203, 223, 244, 264, 285, 306, 328, 351]
  56.   set pEdisonBox = rect(283, 192, 405, 364)
  57.   set pJournalActive = false
  58.   return me
  59.   
  60. end mInit
  61. --------------------------------------------------------------------<<ò>>
  62. on mActivate me
  63.   
  64.   if pAtBIY then
  65.     
  66.     if (gInventorIndexNum < 4) and (gInventorIndexNum > 0) then
  67.       
  68.       set pJournalActive = true
  69.       -- set pCurrentBIYobj = getAt(pBIYobjList, gInventorIndexNum)
  70.       set pCurrentBIYobj = gActiveBYSobj
  71.       
  72.       mSwitchToJournal(pCurrentBIYobj)
  73.       
  74.       puppetSprite pPICTsprite, true
  75.       puppetSprite pClickBoardSpriteNum, true
  76.       puppetSprite pCheckSpriteNum, true
  77.       set the trails of sprite pCheckSpriteNum = true
  78.       set the rect of sprite pClickBoardSpriteNum = pClickBoardRect
  79.       set the castNum of sprite pPICTsprite = the number of cast getAt(pPICTlist, gInventorIndexNum)
  80.       updateStage
  81.       
  82.       if gInventorIndexNum = 1 then
  83.         mDrawEdisonChecks(me)
  84.       else if gInventorIndexNum = 2 then
  85.         mDrawBellChecks(me)
  86.       else if gInventorIndexNum = 3 then
  87.         mDrawWattChecks(me)
  88.       end if
  89.       
  90.     end if
  91.     
  92.   else  mClearBtnHilites ( gInterfaceMgrObj )
  93.   
  94.   mSetCursors(gUtilityObj, [21:Return,22:#Return])
  95.   
  96. end mActivate
  97.  
  98. --------------------------------------------------------------------<<ò>>
  99. on mDiscloseJournalActive me
  100.   
  101.   return pJournalActive
  102.   
  103. end  mDiscloseJournalActive
  104. --------------------------------------------------------------------<<ò>>
  105. on mClose me
  106.   
  107.   set pJournalActive = false
  108.   puppetSprite pPICTsprite, false
  109.   puppetSprite pClickBoardSpriteNum, false
  110.   puppetSprite pCheckSpriteNum, false
  111.   set the trails of sprite pCheckSpriteNum = false
  112.   mClearBtnHilites ( gInterfaceMgrObj )
  113.   updatestage
  114.   
  115.   mSwitchToBIY(pCurrentBIYobj)
  116.   
  117. end mClose
  118. --------------------------------------------------------------------<<ò>>
  119. on mAtBYS me
  120.   
  121.   return( pAtBIY )
  122.   
  123. end mAtBYS
  124. --------------------------------------------------------------------<<ò>>
  125. on mInformJournal me, argStatus
  126.   
  127.   if argStatus = #ArrivingAtBIY then set pAtBIY = true
  128.   else if argStatus = #LeavingBIY then  set pAtBIY = false
  129.   
  130. end mInformJournal
  131. --------------------------------------------------------------------<<ò>>
  132. on mJournalClickEvent me
  133.   
  134.   set mousePoint = point(the mouseH, the mouseV)
  135.   if gInventorIndexNum = 1 then mEdisonJrnlClick(me, mousePoint)
  136.   else if gInventorIndexNum = 2 then mBellJrnlClick(me, mousePoint)
  137.   else if gInventorIndexNum = 3 then mWattJrnlClick(me, mousePoint)
  138.   dontpassevent
  139.   
  140. end mJournalClickEvent
  141. --------------------------------------------------------------------<<ò>>
  142. on mEdisonJrnlClick me, argMousePoint
  143.   
  144.   if inside (argMousePoint, pEdisonBox) then
  145.     set GridPoint = mRectGridCheck(me, pEdisonBox, argMousePoint, 5, 8)             --GridPoint is a list: [x, y]
  146.     set CollumClicked = getAt(GridPoint, 1)
  147.     set RowClicked = (getAt(GridPoint, 2))
  148.     set BIYrecordList = mDiscloseTestRecord(pCurrentBIYobj)
  149.     set BIYrecordIndex = (CollumClicked - 1) * 8 + RowClicked
  150.     set ClickedACheck = getAt(BIYrecordList, BIYrecordIndex)
  151.     if ClickedACheck then 
  152.       mClose(me)
  153.       mReviewExperiment(pCurrentBIYobj, RowClicked, CollumClicked)
  154.     end if
  155.   else
  156.     mClose(me)
  157.   end if
  158.   
  159. end mEdisonJrnlClick
  160. --------------------------------------------------------------------<<ò>>
  161. on mWattJrnlClick me, argMousePoint
  162.   
  163.   if inside(argMousePoint, pWattTopBox) then
  164.     set HitaBox = true
  165.     set WhichBox = pWattTopBox
  166.     set vAdjuster = 0
  167.   else if inside(argMousePoint, pWattBottomBox) then
  168.     set HitaBox = true
  169.     set WhichBox = pWattBottomBox
  170.     set vAdjuster = 3
  171.   else
  172.     set HitaBox = false
  173.     mClose(me)
  174.   end if
  175.   
  176.   if HitaBox then
  177.     
  178.     set GridPoint = mRectGridCheck(me, WhichBox, argMousePoint, 3, 3)             --GridPoint is a list: [x, y]
  179.     set CollumClicked = getAt(GridPoint, 1)
  180.     set RowClicked = (getAt(GridPoint, 2)) + vAdjuster
  181.     
  182.     --/
  183.     --    set ExperimentRecordIndex = ((CollumClicked - 1) * 6) + RowClicked
  184.     --    set WattTestRecord = mDiscloseTestRecord(pCurrentBIYobj)
  185.     --/
  186.     
  187.     --  if getAt(WattTestRecord, ExperimentRecordIndex) then
  188.     mClose(me)
  189.     mReviewExperiment(pCurrentBIYobj, RowClicked, Collumclicked)
  190.     --  end if
  191.     
  192.   end if
  193.   
  194. end mWattJrnlClick
  195. --------------------------------------------------------------------<<ò>>
  196. on mBellJrnlClick me, argMousePoint
  197.   
  198.   if inside(argMousePoint, pBellTopBox) then
  199.     set HitaBox = true
  200.     set WhichBox = pBellTopBox
  201.     set vAdjuster = 0
  202.   else if inside(argMousePoint, pBellMiddleBox) then
  203.     set HitaBox = true
  204.     set WhichBox = pBellMiddleBox
  205.     set vAdjuster = 4
  206.   else if inside(argMousePoint, pBellBottomBox) then
  207.     set HitaBox = true
  208.     set WhichBox = pBellBottomBox
  209.     set vAdjuster = 8
  210.   else
  211.     set HitaBox = false
  212.     mClose(me)
  213.   end if
  214.   
  215.   if HitaBox then
  216.     set GridPoint = mRectGridCheck(me, WhichBox, argMousePoint, 3, 4)
  217.     set CollumClicked = getAt(GridPoint, 1)
  218.     set RowClicked = (getAt(GridPoint, 2)) + vAdjuster
  219.     set BellTestRecord = mDiscloseTestRecord(pCurrentBIYobj)
  220.     set ExperimentRecordIndex = ((CollumClicked - 1) * 12) + RowClicked 
  221.     if getAt(BellTestRecord, ExperimentRecordIndex) = 1 then
  222.       mClose(me)
  223.       mReviewExperiment(pCurrentBIYobj, RowClicked, Collumclicked)
  224.     end if
  225.   end if
  226.   
  227. end mBellJrnlClick
  228. --------------------------------------------------------------------<<ò>>
  229. on mRectGridCheck me, argWhichBox, argMousePoint, argNumCollums, argNumRows
  230.   
  231.   set RectWidth = getAt(argWhichBox, 3) - getAt(argWhichBox, 1)
  232.   set RectHeight = getAt(argWhichBox, 4) - getAt(argWhichBox, 2)
  233.   set RelativeMouseX = getAt(argMousePoint, 1) - getAt(argWhichBox, 1)
  234.   set RelativeMouseY = getAt(argMousePoint, 2) - getAt(argWhichBox, 2)
  235.   set CollumClicked = RelativeMouseX / (RectWidth / argNumCollums) + 1
  236.   set RowClicked = RelativeMouseY / (RectHeight / argNumRows) + 1
  237.   return [CollumClicked, RowClicked]
  238.   
  239. end mRectGridCheck
  240. --------------------------------------------------------------------<<ò>>
  241. on mDrawEdisonChecks me                      --pEdisonLocHList pEdisonLocVList pEdisonBox
  242.   
  243.   set the castNum of sprite pCheckSpriteNum = pCheckBaseCastNum
  244.   set CorrectX = mDiscloseCorrectX(pCurrentBIYobj)
  245.   set CorrectY = mDiscloseCorrectY(pCurrentBIYobj)
  246.   set BIYrecord = mDiscloseTestRecord(pCurrentBIYobj)
  247.   set BIYrecordIndex = 1
  248.   
  249.   repeat with CurrentCollum = 1 to count(pEdisonLocHList)
  250.     set xCoordinate = getAt(pEdisonLocHList, CurrentCollum)
  251.     repeat with CurrentRow = 1 to count(pEdisonLocVList)
  252.       if getAt(BIYrecord, BIYrecordIndex) = true then
  253.         set yCoordinate = getAt(pEdisonLocVList, CurrentRow)
  254.         if (getPos(pEdisonLocHList, xCoordinate) = CorrectX) and (getPos(pEdisonLocVList, yCoordinate) = CorrectY) then
  255.           set the castNum of sprite pCheckSpriteNum = pCheckBaseCastNum + 1 --red checkMark
  256.         else
  257.           set the castNum of sprite pCheckSpriteNum = pCheckBaseCastNum       --black checkMark
  258.         end if
  259.         set the locH of sprite pCheckSpriteNum = xCoordinate
  260.         set the locV of sprite pCheckSpriteNum = yCoordinate
  261.         updateStage
  262.       end if
  263.       set BIYrecordIndex = BIYrecordIndex + 1
  264.     end repeat
  265.   end repeat
  266.   
  267. end mDrawEdisonChecks
  268. --------------------------------------------------------------------<<ò>>
  269. on mDrawWattChecks me
  270.   
  271.   set the castNum of sprite pCheckSpriteNum = pCheckBaseCastNum
  272.   set CorrectX = mDiscloseCorrectX(pCurrentBIYobj)
  273.   set CorrectY = mDiscloseCorrectY(pCurrentBIYobj)
  274.   set BIYrecord = mDiscloseTestRecord(pCurrentBIYobj)
  275.   set BIYrecordIndex = 1
  276.   repeat with CurrentRow = 1 to count(pCylinderAxisLocVList)
  277.     set yCoordinate = getAt(pCylinderAxisLocVList, CurrentRow)
  278.     repeat with CurrentCollum = 1 to count(pCondensorAxisLocHList)
  279.       if getAt(BIYrecord, BIYrecordIndex) = true then
  280.         set xCoordinate = getAt(pCondensorAxisLocHList, CurrentCollum)
  281.         if (getPos(pCondensorAxisLocHList, xCoordinate) = CorrectX) and (getPos(pCylinderAxisLocVList, yCoordinate) = CorrectY) then
  282.           set the castNum of sprite pCheckSpriteNum = pCheckBaseCastNum + 1 --red checkMark
  283.         else
  284.           set the castNum of sprite pCheckSpriteNum = pCheckBaseCastNum       --black checkMark
  285.         end if
  286.         set the locH of sprite pCheckSpriteNum = xCoordinate
  287.         set the locV of sprite pCheckSpriteNum = yCoordinate
  288.         updateStage
  289.       end if
  290.       set BIYrecordIndex = BIYrecordIndex + 1
  291.     end repeat
  292.   end repeat
  293.   
  294. end mDrawWattChecks
  295. --------------------------------------------------------------------<<ò>>
  296. on mDrawBellChecks me
  297.   
  298.   set the castNum of sprite pCheckSpriteNum = pCheckBaseCastNum
  299.   set CorrectX = mDiscloseCorrectX(pCurrentBIYobj)
  300.   set CorrectY = mDiscloseCorrectY(pCurrentBIYobj)
  301.   set CorrectZ = mDiscloseCorrectZ(pCurrentBIYobj)
  302.   set AdjustedCorrectY = (CorrectZ - 1) * 4 + CorrectY
  303.   set BIYrecord = mDiscloseTestRecord(pCurrentBIYobj)
  304.   
  305.   
  306.   
  307.   set yCounter = 1
  308.   repeat with yCoordinate in pBellLocVList
  309.     set xCounter = 1
  310.     repeat with xCoordinate in pBellLocHList
  311.       set RecordIndex = (xCounter - 1) * 12 + yCounter
  312.       if (xCoordinate = CorrectX) and (yCoordinate = CorrectY) then
  313.         set the castNum of sprite pCheckSpriteNum = pCheckBaseCastNum + 1 --red checkMark
  314.       else
  315.         set the castNum of sprite pCheckSpriteNum = pCheckBaseCastNum       --black checkMark
  316.       end if
  317.       if getAt(BIYrecord, RecordIndex) =1 then
  318.         set the locH of sprite pCheckSpriteNum = xCoordinate
  319.         set the locV of sprite pCheckSpriteNum = yCoordinate
  320.         updateStage
  321.       end if
  322.       set xCounter = xCounter + 1
  323.     end repeat
  324.     set yCounter = yCounter + 1
  325.   end repeat
  326.   set the locH of sprite pCheckSpriteNum = -500
  327.   
  328. end mDrawBellChecks
  329. --------------------------------------------------------------------<<ò>>
  330. --------------------------------------------------------------------<<ò>>